package com.hera.process.config.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.hera.base.dao.repository.BaseRepository;
import com.hera.process.config.domain.ParameterDetail;
import com.hera.process.security.domain.SecGroupModule;
import com.hera.process.security.domain.SecGroupModulePK;

public interface SecGroupModuleDao extends BaseRepository<SecGroupModule, SecGroupModulePK>{

	@Modifying
	@Transactional
	@Query("delete from SecGroupModule o where o.secGroupModulePK.idSecurityGroup = ?")
	void deleteBySecGroupModule(Long idSecurityGroup);

	@Query("select o.module from SecGroupModule o where o.secGroupModulePK.idSecurityGroup = ?")
	List<ParameterDetail> findAllModulosSiasignado(Long idSecurityGroup);

	
	@Query("select o from ParameterDetail o where o.parameter.idParameter = 8 and o.idParameterDetail not in ?1")
	List<ParameterDetail> findAllModulosNoasignado(List codigos);
	
	@Query("select o.secGroupModulePK.idModule from SecGroupModule o where o.secGroupModulePK.idSecurityGroup = ?")
	List<Long> findAllModulosSiasignadoIds(Long idSecurityGroup);

	
	
	
	
}
